package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the WORK_CENTER database table.
 * 
 */
@Entity
@Table(name="WORK_CENTER")
public class WorkCenter implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="WORK_CENTER_ID")
	private String workCenterId;

	private String city;

	@Column(name="\"STATE\"")
	private String state;

	//bi-directional many-to-one association to Employee
	@OneToMany(mappedBy="workCenter")
	private List<Employee> employees;

	//bi-directional many-to-many association to Product
	@ManyToMany
	@JoinTable(
		name="PRODUCED_IN"
		, joinColumns={
			@JoinColumn(name="WORK_CENTER_ID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="PRODUCT_ID")
			}
		)
	private List<Product> products;

	public WorkCenter() {
	}

	public String getWorkCenterId() {
		return this.workCenterId;
	}

	public void setWorkCenterId(String workCenterId) {
		this.workCenterId = workCenterId;
	}

	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public List<Employee> getEmployees() {
		return this.employees;
	}

	public void setEmployees(List<Employee> employees) {
		this.employees = employees;
	}

	
	public Employee addEmployees(Employee employees) {
		getEmployees().add(employees);
		employees.setWorkCenter(this);

		return employees;
	}

	public Employee removeEmployees(Employee employees) {
		getEmployees().remove(employees);
		employees.setWorkCenter(null);

		return employees;
	}
	public List<Product> getProducts() {
		return this.products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

	
}